<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="css/dialog.css">
    <script src="jquery-3.6.0.min.js"></script>
</head>

<body>
    <div class="dialog" id="box">
        <div class="dialog-title" id="drop">
            <span>注册信息（可以拖曳）</span>
            <div class="dialog-close" id="close">×</div>
        </div>
        <div class="dialog-body">
        </div>
    </div>
    <script>
        $(function() {
            $("#close").on("click", function() {
                $(this).parent().parent().hide();
            })
            $("#drop").on("mousedown", function(e) {
                var x = e.pageX - $(this).parent().offset().left;
                var y = e.pageY - $(this).parent().offset().top;
                $(document).on("mousemove", function(e) {
                    $("#box").offset({
                        left: e.pageX - x,
                        top: e.pageY - y
                    })
                })
                $(document).on("mouseup", function() {
                    $(document).off("mousemove");
                })
            })
        })
    </script>
</body>

</html>